package com.axend.aerosense.common.bean;

import com.axend.aerosense.base.bean.BaseBean;
import com.axend.aerosense.common.R;

public class RadarBean extends BaseBean {
    //雷达名字
    private String radarName;
    //雷达uuid
    private String radarUuid;
    //雷达状态0：正常 1：离线
    private int radarState = 1;
    //雷达版本号
    private String radarVersion;
    //雷达更新状态 0:不需要更新 1:需要更新
    private int radarVersionState;
    //雷达安装的房间
    private String roomName;
    //雷达类型
    private int type;
    //是否为未分配
    private boolean isUnassigned;
    /**是否正在升级*/
    private boolean upgrading;
    /**是否可以更新固件*/
    private boolean update;


    public RadarBean() {
    }

    public RadarBean(String radarName, String radarUuid, int radarState, String roomName) {
        this.radarName = radarName;
        this.radarUuid = radarUuid;
        this.radarState = radarState;
        this.roomName = roomName;
    }


    public String getRadarName() {
        return radarName;
    }

    public String getRadarUuid() {
        return radarUuid;
    }

    public int getRadarState() {
        return radarState;
    }

    public String getRadarVersion() {
        return radarVersion;
    }

    public boolean getRadarVersionState() {
        return radarVersionState > 0;
    }

    public String getRoomName() {
        return roomName;
    }

    public RadarType getType() {
        return RadarType.getType(type);
    }

    public void setType(RadarType type){
        this.type = type.get();
    }

    public boolean isUnassigned() {
        return isUnassigned;
    }

    public void setUnassigned(boolean unassigned) {
        isUnassigned = unassigned;
    }

    public boolean isUpgrading() {
        return upgrading;
    }

    public void setUpgrading(boolean upgrading) {
        this.upgrading = upgrading;
    }

    public boolean isUpdate() {
        return update;
    }

    public void setUpdate(boolean update) {
        this.update = update;
    }

    public int getStateImageId(){
        int imageId = R.drawable.common_icon_circle_blue;
        switch (getRadarState()){
            case 0: // 正常
                imageId = R.drawable.common_icon_circle_blue;
                break;
            case 2: // 报警
                imageId = R.drawable.common_icon_circle_red;
                break;
            case 1: // 离线
                imageId = R.drawable.common_icon_circle_orange;
                break;
        }
        return imageId;
    }
}
